home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODFDev / ODF / OS / FWGraphx / FWLinShp.h < prev    next >
Encoding:
Text File  |  1996-09-17  |  3.8 KB  |  136 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                FWLinShp.h
  4. //    Release Version:    $ ODF 2 $
  5. //
  6. //    Copyright:    (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #ifndef FWLINSHP_H
  11. #define FWLINSHP_H
  12.  
  13. #ifndef FWSHAPE_H
  14. #include "FWShape.h"
  15. #endif
  16.  
  17. #ifndef FWRECT_H
  18. #include "FWRect.h"
  19. #endif
  20.  
  21. //========================================================================================
  22. //    Forward Declarations
  23. //========================================================================================
  24.  
  25. class FW_CGraphicContext;
  26. class ODTransform;
  27.  
  28. //========================================================================================
  29. //    class FW_CLineShape
  30. //========================================================================================
  31.  
  32. class FW_CLineShape : public FW_CShape
  33. {
  34. public:
  35.     FW_DECLARE_CLASS
  36.     FW_DECLARE_AUTO(FW_CLineShape)
  37.  
  38. //---------------------------------------------------------------------------------------
  39. //    Constructors/Destructors
  40. //
  41. public:
  42.     FW_CLineShape();
  43.  
  44.     FW_CLineShape(FW_Fixed xStart, FW_Fixed yStart,
  45.                   FW_Fixed xEnd, FW_Fixed yEnd,
  46.                   const FW_CInk& ink = FW_kNormalInk,
  47.                   const FW_CStyle& style = FW_kNormalStyle);
  48.  
  49.     FW_CLineShape(const FW_CPoint& start,
  50.                   const FW_CPoint& end,
  51.                   const FW_CInk& ink = FW_kNormalInk,
  52.                   const FW_CStyle& style = FW_kNormalStyle);
  53.  
  54.     FW_CLineShape(const FW_CLineShape& other);
  55.     FW_CLineShape(FW_CReadableStream& stream);
  56.     
  57.     virtual ~ FW_CLineShape();
  58.  
  59. //----------------------------------------------------------------------------------------
  60. //    Operators
  61. //
  62. public:
  63.     FW_CLineShape& operator=(const FW_CLineShape& other);
  64.     
  65. //---------------------------------------------------------------------------------------
  66. //    Inherited API
  67. //
  68. public:
  69.     // ----- Rendering -----
  70.     virtual void            Render(FW_CGraphicContext& gc) const;
  71.  
  72.     // ----- Hit Testing -----
  73.     virtual FW_Boolean     HitTest(FW_CGraphicContext& gc,
  74.                                     const FW_CPoint& test,
  75.                                     FW_Fixed tolerance) const;
  76.     
  77.     // ----- Copying -----
  78.     virtual FW_CShape*        Copy() const;
  79.     
  80.     // ----- Transform -----
  81.     virtual void            Transform(Environment *ev, ODTransform* transform);
  82.     virtual void            InverseTransform(Environment *ev, ODTransform* transform);
  83.  
  84.     virtual void            MoveShape(FW_Fixed deltaX, FW_Fixed deltaY);
  85.     virtual void            MoveShapeTo(FW_Fixed x, FW_Fixed y);
  86.  
  87.     virtual void            Inset(FW_Fixed x, FW_Fixed y);
  88.     
  89.     // ----- Geometry -----
  90.     virtual void             GetBounds(FW_CGraphicContext& gc, FW_CRect& rect) const;
  91.  
  92.     // ----- Anchor Point -----
  93.     virtual FW_CPoint        GetAnchorPoint() const;
  94.     
  95.     // ----- Flatten -----
  96.     virtual void            Flatten(FW_CWritableStream& stream) const;
  97.     
  98. //---------------------------------------------------------------------------------------
  99. //    New API
  100. //
  101. public:
  102.     // ----- Rendering -----
  103.     static void    RenderLine(FW_CGraphicContext& gc,
  104.                                 const FW_CPoint& start, 
  105.                                 const FW_CPoint& end,
  106.                                 const FW_CInk& ink = FW_kNormalInk,
  107.                                 const FW_CStyle& style = FW_kNormalStyle);
  108.  
  109.     // ----- Archiving -----
  110.     static void*     Read(FW_CReadableStream& stream, FW_ClassTypeConstant type);
  111.  
  112.     // ----- Geometry -----
  113.     void            GetGeometry(FW_CPoint& start, FW_CPoint& end) const;
  114.     void            SetGeometry(const FW_CPoint& start, const FW_CPoint& end);
  115.  
  116.     FW_CPoint        GetLineStart() const
  117.                         {return fStart;}
  118.     FW_CPoint        GetLineEnd() const
  119.                         {return fEnd;}
  120.     
  121.     void            SetLineStart(FW_Fixed xStart, FW_Fixed yStart)
  122.                         {fStart.x = xStart; fStart.y = yStart;}
  123.  
  124.     void            SetLineEnd(FW_Fixed xEnd, FW_Fixed yEnd)
  125.                         {fEnd.x = xEnd; fEnd.y = yEnd;}
  126.  
  127. //---------------------------------------------------------------------------------------
  128. //    Data Members
  129. //
  130. private:
  131.     FW_CPoint        fStart;
  132.     FW_CPoint        fEnd;
  133. };
  134.  
  135. #endif
  136.